package com.ksd.web.controller.system;

import com.ksd.common.core.domain.AjaxResult;
import com.ksd.system.service.ISysOperLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ksd.common.config.PlayDataConfig;
import com.ksd.common.utils.StringUtils;

import java.io.File;

/**
 * 首页
 *
 * @author ruoyi
 */
@RestController
public class SysIndexController
{
    /** 系统基础配置 */
    @Autowired
    private PlayDataConfig ruoyiConfig;

    @Autowired
    private ISysOperLogService sysOperLogService;

    private static final Logger logger = LoggerFactory.getLogger(SysIndexController.class);

    /**
     * 访问首页，提示语
     */
    @RequestMapping("/")
    public String index()
    {
        return StringUtils.format("欢迎使用{}后台管理框架，当前版本：v{}，请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
    }

    public static String OSChecker(){
        String os = System.getProperty("os.name").toLowerCase();
        System.out.println(os);
        if (os.contains("win")) {
            System.out.println("This is a Windows environment.");
            return "Windows";
        } else if (os.contains("nix") || os.contains("nux") || os.contains("mac")) {
            System.out.println("This is a Linux or Unix or Mac environment.");
            return "Linux";
        } else {
            System.out.println("Unknown operating system.");
            return "Unknown";
        }
    }

}
